import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../components/Home.vue'
import UserManagement from '../views/UserManagement.vue'
import StaffManagement from '../views/StaffManagement.vue'
import PostManagement from "../views/PostManagement";
import Login from '../components/Login.vue';
import Register from '../components/Register.vue';
import StationManagement from "../views/StationManagement";
import StationChangeManagement from "../views/StationChangeManagement";
import SalaryManagement from "../views/SalaryManagement";
import DepartmentWork from "../views/DepartmentWork";
import Access_control from "../views/AccessControl";
import TrainManagement from "../views/TrainManagement";
import SalaryChangeManagement from "../views/SalaryChangeManagement";
import AttendanceManagement from "../views/AttendanceManagement";
Vue.use(VueRouter)

const routes = [
  //  路由重定向
  {
    path: '/',
    redirect: 'login'
  },
  {
    path:'/login',
    component: Login
  },
  {
    path:'/register',
    component:Register
  },
  //  主页内置路由
  {
    path:'/home',
    component: Home,
    redirect: '/manage/user',
    children:[
      {
        path: '/manage/user',
        component: UserManagement
      },
      {
        path: '/manage/info_staff',
        component: StaffManagement
      },
      {
        path: '/manage/post',
        component: PostManagement
      },
      {
        path: '/manage/station',
        component: StationManagement
      },
      {
        path: '/manage/station_change',
        component: StationChangeManagement
      },
      {
        path: '/manage/salary',
        component: SalaryManagement
      },
      {
        path:'/manage/work',
        component: DepartmentWork
      },
      {
        path:'/manage/access_control',
        component: Access_control
      },
      {
        path:'/manage/train',
        component: TrainManagement
      },
      {
        path:'/manage/attendance',
        component: AttendanceManagement
      },
      {
        path:'/manage/salary_change',
        component: SalaryChangeManagement
      }
    ]
  },

]

const router = new VueRouter({
  routes
})

export default router
